package com.gzyj.flink.driver;

import lombok.Getter;

/**
 * @author lhj
 */
@Getter
public enum ICCardReadResult {

    IC卡读卡成功(0x00,"IC卡读卡成功"),
    读卡失败_原因为卡片密钥认证未通过(0x01,"读卡失败，原因为卡片密钥认证未通过"),
    读卡失败_原因为卡片已被锁定(0x02,"读卡失败，原因为卡片已被锁定"),
    读卡失败_原因为卡片被拔出(0x03,"读卡失败，原因为卡片被拔出"),
    读卡失败_原因为数据校验错误(0x04,"读卡失败，原因为数据校验错误"),
    ;

    private int code;
    private String name;

    ICCardReadResult(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public static ICCardReadResult find(int code) {
        for (ICCardReadResult result : ICCardReadResult.values()) {
            if (result.getCode() == code) {
                return result;
            }
        }
        return null;
    }
}
